module VirtualCity.Rendering

open Casanova
open Casanova.Utilities
open Casanova.Core
open Casanova.Coroutines
open Casanova.Game
open Casanova.Input
open Casanova.Math
open Casanova.Drawing
open Casanova.StandardLibrary.Core
open Casanova.StandardLibrary.Physics


/// The layers of the game world, rendered in the following order:
/// - the background tiles
/// - the streets
/// - the buildings (and the bus stops)
/// - the items inside the buildings
/// - the text overlay for building or item names
/// - the actors
/// - the UI for additional 2D information
type [<CasanovaEntity>] Layers = { 
  Background  : SpriteLayer
  Roads       : SpriteLayer
  Buildings   : SpriteLayer
  Items       : SpriteLayer
  Overlay     : SpriteLayer
  Agents      : SpriteLayer
  UI          : SpriteLayer
  Camera      : Ref<Camera2D>
} with
  static member RoadsTransformRule(self:Layers,dt:float32<s>) = (!self.Camera).Transform
  static member BuildingsTransformRule(self:Layers,dt:float32<s>) = (!self.Camera).Transform
  static member ItemsTransformRule(self:Layers,dt:float32<s>) = (!self.Camera).Transform
  static member OverlayTransformRule(self:Layers,dt:float32<s>) = (!self.Camera).Transform
  static member AgentsTransformRule(self:Layers,dt:float32<s>) = (!self.Camera).Transform


and VisualEntity = DrawableSprite

